/*************************************************************************************************
 * Class to represent a circle. The class inherits geometric element. 
 * A circle is characterized by its radius. Its area is pi*(radius)^2. 
 *************************************************************************************************/

package geometricElement;

public class Circle extends GeometricElement {
	
	// members
	private static final double PI = 3.14;
	private double radius; // circle's radius

	/*************************************************************************************************
	 * Function name: public Circle(int xCord, int yCord, double radius)
	 * Input: Position and radius of the new circle
	 * Output: None
	 * Function operation: Constructor- creates a new circle with given values
	 *************************************************************************************************/
	public Circle(int xCord, int yCord, double radius) {
		// set radius as given value
		super(xCord, yCord);
		this.radius = radius;
		// set area according to circle's method
		setArea(calculateArea());
	}
	
	/*************************************************************************************************
	 * Function name: public double calculateArea()
	 * Input: None
	 * Output: Circle's area
	 * Function operation: Calculates circle's area and returns it
	 *************************************************************************************************/
	public double calculateArea() {
		return PI*radius*radius; // circle's area is pi*(radius)^2
	}
	
	/*************************************************************************************************
	 * Function name: public Circle clone()
	 * Input: None
	 * Output: Reference to circle's copy
	 * Function operation: Allocates a new circle with activating circle's attributes and returns a 
	 * 					   reference to the copy 
	 *************************************************************************************************/
	public Circle clone() {
		// return reference to object's copy
		return new Circle(getXcord(), getYcord(), radius); 
	}
	
	public String toString() {
		return "Type: Circle, " + super.toString();
	}
}
